package net.zeus.sample.rabbitmq.work;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

import net.zeus.sample.rabbitmq.utils.ConnectionUtils;

public class WorkMqSender {

	public static void main(String[] args) throws Exception {
		Connection conn = ConnectionUtils.getConnection();
		
		Channel channel = conn.createChannel();
		
		channel.queueDeclare(ConnectionUtils.WORK_QUEUE_NAME, false, false, false, null);
		
		for (int i = 0; i < 50; i++) {
			String msg = "hello work test[" + i + "]";
			
			channel.basicPublish("", ConnectionUtils.WORK_QUEUE_NAME, null, msg.getBytes());
			System.out.println("send msg:" + msg);
			
			Thread.sleep(i * 20);
		}
		
		channel.close();
		ConnectionUtils.closeConnection(conn);
	}

}
